package angels.client.Entities;
import org.json.JSONException;
import org.json.JSONObject;
import com.google.android.maps.GeoPoint;

public class Sharing {
	private String name;
	private String desc;
	private GeoPoint coords;
	private String bkey;
	private String ctime;
	private int likes,dislikes;
	private double userRating;
	
	
	public Sharing(JSONObject json_share) throws JSONException {
		name = json_share.getString("user");
		desc = json_share.getString("desc");
		String[] xy =json_share.getString("loc").split(",");
	    coords = new GeoPoint(
	            (int) (Double.parseDouble(xy[0]) * 1E6),
	            (int) (Double.parseDouble(xy[1]) * 1E6)
	    );
	    //bkey=json_share.getString("bkey");
	    ctime=json_share.getString("ctime");
	    likes=json_share.getInt("likes");
	    dislikes=json_share.getInt("dlikes");
	    userRating =json_share.getDouble("rat");
	}
	
	public String getName(){
		return name;
	}
	
	public String getDescription(){
		return desc;
	}
	
	public GeoPoint getCoords(){
		return coords;
	}
	
	/*public String getBusinessKey(){
		return bkey;
	}*/
	
	public String getDuration(){
		return ctime;
	}
	
	public int getLikes(){
		return likes;
	}
	
	public int getDislikes(){
		return dislikes;
	}
	
	public double getUserRating(){
		return userRating/10;
	}
}